import { COUNTER_MINUS_ONE } from "./constant";
import initialState from "./initialState";

// action
export const counterMinusOne = () => {
  return {
    type: COUNTER_MINUS_ONE
  };
};

// reducer
export const reducer = (state = initialState, action) => {
  switch (action.type) {
    case COUNTER_MINUS_ONE:
      console.log("state in minus:", state);
      return { count: state.count - 1 };
    default:
      console.log("state in default minus:", state);
      return state;
  }
};
